<?php
/**
*  日志模型
*
*  @author			leosio <http://www.leosio.com>
*  @description		日志模型
*  @date			2012-9-17 21:57:45
*/
class LogModel extends Model {
	/**
	*	写日志
	*
	*	@param
	*	@return
	*	@date	2012-9-20 22:43:58
	*	@author lin.x
	*
	*/
	public function log($msg){
		$data = array(
			'dateline'	=>	time(),
			'content'	=>	addslashes($msg)
		);
		return $this->add($data);
	}
	/**
	*	清理日志
	*
	*	@param
	*	@return
	*	@date	2012-9-20 22:44:01
	*	@author lin.x
	*
	*/
	public function clearlog($n = 120){
		$this->log('清除log');
		$this->where(array(
			'dateline'	=>	array(time() - $n * 3600, '<')
		))->delete();
	}
}